home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 2.iso / dist / fw_libgtop.idb / usr / freeware / include / libgtop-1.0 / glibtop / cpu.h.z / cpu.h
C/C++ Source or Header  |  2002-07-08  |  3KB  |  100 lines

  1. /* $Id: cpu.h,v 1.14 1999/02/23 11:42:50 martin Exp $ */
  2.  
  3. /* Copyright (C) 1998-99 Martin Baulig
  4.    This file is part of LibGTop 1.0.
  5.  
  6.    Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
  7.  
  8.    LibGTop is free software; you can redistribute it and/or modify it
  9.    under the terms of the GNU General Public License as published by
  10.    the Free Software Foundation; either version 2 of the License,
  11.    or (at your option) any later version.
  12.  
  13.    LibGTop is distributed in the hope that it will be useful, but WITHOUT
  14.    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15.    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  16.    for more details.
  17.  
  18.    You should have received a copy of the GNU General Public License
  19.    along with LibGTop; see the file COPYING. If not, write to the
  20.    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21.    Boston, MA 02111-1307, USA.
  22. */
  23.  
  24. #ifndef __GLIBTOP_CPU_H__
  25. #define __GLIBTOP_CPU_H__
  26.  
  27. #include <glibtop.h>
  28. #include <glibtop/global.h>
  29.  
  30. BEGIN_LIBGTOP_DECLS
  31.  
  32. #define GLIBTOP_CPU_TOTAL    0
  33. #define GLIBTOP_CPU_USER    1
  34. #define GLIBTOP_CPU_NICE    2
  35. #define GLIBTOP_CPU_SYS        3
  36. #define GLIBTOP_CPU_IDLE    4
  37. #define GLIBTOP_CPU_FREQUENCY    5
  38.  
  39. #define GLIBTOP_XCPU_TOTAL    6
  40. #define GLIBTOP_XCPU_USER    7
  41. #define GLIBTOP_XCPU_NICE    8
  42. #define GLIBTOP_XCPU_SYS    9
  43. #define GLIBTOP_XCPU_IDLE    10
  44.  
  45. #define GLIBTOP_MAX_CPU        11
  46.  
  47. /* Nobody should really be using more than 4 processors. */
  48. #define GLIBTOP_NCPU        4
  49.  
  50. typedef struct _glibtop_cpu    glibtop_cpu;
  51.  
  52. struct _glibtop_cpu
  53. {
  54.     u_int64_t    flags,
  55.         total,                /* GLIBTOP_CPU_TOTAL        */
  56.         user,                /* GLIBTOP_CPU_USER        */
  57.         nice,                /* GLIBTOP_CPU_NICE        */
  58.         sys,                /* GLIBTOP_CPU_SYS        */
  59.         idle,                /* GLIBTOP_CPU_IDLE        */
  60.         frequency,            /* GLIBTOP_CPU_FREQUENCY    */
  61.         xcpu_total [GLIBTOP_NCPU],    /* GLIBTOP_XCPU_TOTAL        */
  62.         xcpu_user [GLIBTOP_NCPU],    /* GLIBTOP_XCPU_USER        */
  63.         xcpu_nice [GLIBTOP_NCPU],    /* GLIBTOP_XCPU_NICE        */
  64.         xcpu_sys  [GLIBTOP_NCPU],    /* GLIBTOP_XCPU_SYS        */
  65.         xcpu_idle [GLIBTOP_NCPU];    /* GLIBTOP_XCPU_IDLE        */
  66. };
  67.  
  68. #define glibtop_get_cpu(cpu)    glibtop_get_cpu_l(glibtop_global_server, cpu)
  69.  
  70. #if GLIBTOP_SUID_CPU
  71. #define glibtop_get_cpu_r    glibtop_get_cpu_p
  72. #else
  73. #define glibtop_get_cpu_r    glibtop_get_cpu_s
  74. #endif
  75.  
  76. void glibtop_get_cpu_l (glibtop *server, glibtop_cpu *buf);
  77.  
  78. #if GLIBTOP_SUID_CPU
  79. void glibtop_init_cpu_p (glibtop *server);
  80. void glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf);
  81. #else
  82. void glibtop_init_cpu_s (glibtop *server);
  83. void glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf);
  84. #endif
  85.  
  86. #ifdef GLIBTOP_NAMES
  87.  
  88. /* You need to link with -lgtop_names to get this stuff here. */
  89.  
  90. extern const char *glibtop_names_cpu [];
  91. extern const unsigned glibtop_types_cpu [];
  92. extern const char *glibtop_labels_cpu [];
  93. extern const char *glibtop_descriptions_cpu [];
  94.  
  95. #endif
  96.  
  97. END_LIBGTOP_DECLS
  98.  
  99. #endif
  100.